<template>
	<view>
		<view class="statusBar"></view>
		<view class="daohang">
			<view class="daohangicon"></view>
			<view>账户明细</view>
			<view class="daohangicon" @tap="addBtn" style="font-size: 3.2vw;">添加商户</view>
		</view>
		<view class="nav">
			<view :class="type==0?'status':''" @tap="statusBtn" data-type="0">成功</view>
			<view :class="type==1?'status':''" @tap="statusBtn" data-type="1">失败</view>
		</view>
		<view class="content" v-for="(item,index) in list" :key="index">
			<view>{{item.name}}</view>
			<view>{{item.remarks}}</view>
		</view>
		<!-- <view class="content">
			<view>商户名称</view>
			<view>阿萨的</view>
		</view> -->
	</view>
</template>

<script>
	const http = require('../../utils/http.js');
	export default {
		data() {
			return {
				list:null,
				type:0
			}
		},
		onLoad(options) {
			
		},
		onShow() {
			uni.showLoading({
			    title: '加载中'
			});
			http.get('/api/merchant/selectList',{status:this.type}).then(res => {
				//console.log(res)
				if (res.code == 200 && res.result) {
					this.list=res.result
				}
				uni.hideLoading();
			})
		},
		methods: {
			statusBtn:function(e){
				this.type=e.currentTarget.dataset.type
				uni.showLoading({
				    title: '加载中'
				});
				http.get('/api/merchant/selectList',{status:this.type}).then(res => {
					//console.log(res)
					if (res.code == 200 && res.result) {
						this.list=res.result
					}
					uni.hideLoading();
				})
			},
			addBtn:function(){
				uni.navigateTo({
				    url: '/pages/merchant/addMerchant'
				})
				// uni.navigateTo({
				// 	url:'/pages/bank/deployBank'
				// })
			}
		}
	}
</script>

<style>
	page{
		color: #333333;
		background: #FFFFFF;
	}
	.statusBar{
		height: 6vw;
		background-image: linear-gradient(45deg, #24EBA9, #10C7B2);
	}
	.status{
		border-bottom: 2px solid #24EBA9;
	}
	.daohang{
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: #FFFFFF;
		background-image: linear-gradient(45deg, #24EBA9, #10C7B2);
		padding: 2.8vw 3vw;
	}
	.daohang .daohangicon{
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		font-size: 5vw;
		width: 15%;
	}
	.daohang view:nth-child(2){
		text-align: center;
		font-weight: bold;
		font-family: sans-serif;
	}
	.nav{
		display: flex;
		flex-direction: row;
		justify-content: center;
	}
	.nav>view{
		width: 28%;
		text-align: center;
		padding: 3vw;
	}
	.content{
		margin: 5vw;
		padding: 3vw;
		border-radius: 1vw;
		box-shadow:0px 0px 2vw #cbcbcb;
		background: #FFFFFF;
	}
	.content>view:nth-child(1){
		margin-bottom: 2vw;
	}
	.content>view:nth-child(2){
		color: #999999;
	}
</style>
